package com.yuetong.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yuetong.common.annotation.Log;
import com.yuetong.common.core.controller.BaseController;
import com.yuetong.common.core.domain.AjaxResult;
import com.yuetong.common.enums.BusinessType;
import com.yuetong.business.domain.YtEmployeeDocuments;
import com.yuetong.business.service.IYtEmployeeDocumentsService;
import com.yuetong.common.utils.poi.ExcelUtil;
import com.yuetong.common.core.page.TableDataInfo;

/**
 * 证件照信息Controller
 * 
 * @author  卓晓君
 * @date 2025-04-24
 */
@RestController
@RequestMapping("/businesss/employee")
public class YtEmployeeDocumentsController extends BaseController
{
    @Autowired
    private IYtEmployeeDocumentsService ytEmployeeDocumentsService;

    /**
     * 查询证件照信息列表
     */
    @PreAuthorize("@ss.hasPermi('businesss:employee:list')")
    @GetMapping("/list")
    public TableDataInfo list(YtEmployeeDocuments ytEmployeeDocuments)
    {
        startPage();
        List<YtEmployeeDocuments> list = ytEmployeeDocumentsService.selectYtEmployeeDocumentsList(ytEmployeeDocuments);
        return getDataTable(list);
    }

    /**
     * 导出证件照信息列表
     */
    @PreAuthorize("@ss.hasPermi('businesss:employee:export')")
    @Log(title = "证件照信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YtEmployeeDocuments ytEmployeeDocuments)
    {
        List<YtEmployeeDocuments> list = ytEmployeeDocumentsService.selectYtEmployeeDocumentsList(ytEmployeeDocuments);
        ExcelUtil<YtEmployeeDocuments> util = new ExcelUtil<YtEmployeeDocuments>(YtEmployeeDocuments.class);
        util.exportExcel(response, list, "证件照信息数据");
    }

    /**
     * 获取证件照信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('businesss:employee:query')")
    @GetMapping(value = "/{documentId}")
    public AjaxResult getInfo(@PathVariable("documentId") Long documentId)
    {
        return success(ytEmployeeDocumentsService.selectYtEmployeeDocumentsByDocumentId(documentId));
    }

    /**
     * 新增证件照信息
     */
    @PreAuthorize("@ss.hasPermi('businesss:employee:add')")
    @Log(title = "证件照信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YtEmployeeDocuments ytEmployeeDocuments)
    {
        return toAjax(ytEmployeeDocumentsService.insertYtEmployeeDocuments(ytEmployeeDocuments));
    }

    /**
     * 修改证件照信息
     */
    @PreAuthorize("@ss.hasPermi('businesss:employee:edit')")
    @Log(title = "证件照信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YtEmployeeDocuments ytEmployeeDocuments)
    {
        return toAjax(ytEmployeeDocumentsService.updateYtEmployeeDocuments(ytEmployeeDocuments));
    }

    /**
     * 删除证件照信息
     */
    @PreAuthorize("@ss.hasPermi('businesss:employee:remove')")
    @Log(title = "证件照信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{documentIds}")
    public AjaxResult remove(@PathVariable Long[] documentIds)
    {
        return toAjax(ytEmployeeDocumentsService.deleteYtEmployeeDocumentsByDocumentIds(documentIds));
    }
}
